require("lualib_bundle");
__TS__SourceMapTraceBack(debug.getinfo(1).short_src, {["4"] = 1,["5"] = 1,["6"] = 2,["7"] = 2,["8"] = 4,["9"] = 4,["10"] = 4,["12"] = 34,["13"] = 35,["14"] = 36,["15"] = 33,["16"] = 15,["17"] = 16,["18"] = 17,["21"] = 21,["22"] = 22,["23"] = 23,["24"] = 24,["26"] = 27,["27"] = 27,["28"] = 27,["29"] = 27,["30"] = 27,["31"] = 29,["32"] = 29,["33"] = 29,["34"] = 29,["35"] = 29,["36"] = 29,["37"] = 29,["38"] = 29,["39"] = 29,["40"] = 15,["41"] = 12,["42"] = 4});
local ____exports = {}
local ____BaseUtil = require("solar.util.BaseUtil")
local BaseUtil = ____BaseUtil.default
local ____TextTagUtil = require("solar.util.TextTagUtil")
local TextTagUtil = ____TextTagUtil.default
____exports.default = __TS__Class()
local AddGoldOnUseAbilityState = ____exports.default
AddGoldOnUseAbilityState.name = "AddGoldOnUseAbilityState"
function AddGoldOnUseAbilityState.prototype.____constructor(self)
    local triggerHandle = CreateTrigger()
    TriggerRegisterAnyUnitEventBJ(triggerHandle, EVENT_PLAYER_UNIT_SPELL_EFFECT)
    TriggerAddAction(triggerHandle, ____exports.default.action)
end
function AddGoldOnUseAbilityState.action()
    local configData = ____exports.default.config[id2string(GetSpellAbilityId())]
    if not configData then
        return
    end
    local add_gold = GetRandomInt(configData.min, configData.max)
    if configData.timeRate and configData.timeRate > 0 then
        local timeAdd = R2I(BaseUtil.getGameTime() / 60) * configData.min
        add_gold = timeAdd * configData.timeRate + add_gold
    end
    AdjustPlayerStateBJ(
        add_gold,
        GetOwningPlayer(GetTriggerUnit()),
        PLAYER_STATE_RESOURCE_GOLD
    )
    TextTagUtil.text(
        " +" .. tostring(add_gold),
        GetTriggerUnit(),
        15,
        3,
        250,
        204,
        64
    )
end
AddGoldOnUseAbilityState.config = {}
____exports.default = AddGoldOnUseAbilityState
return ____exports
